<#macro categoryTree parentId=''>
    <@_categoryList advanced=true parentId=parentId pageSize=500>
        <#list page.list as a>
            <li>
                <a href="cmsPlace/lookup_content_list.html?categoryId=${a.id}" class="exclude-translate" target="ajax" rel="lookup_content_list">${a.name!}</a>
            <#if a.childIds?has_content>
                <ul>
                    <@categoryTree a.id/>
                </ul>
            </#if>
            </li>
        </#list>
    </@_categoryList>
</#macro>
<#macro lookupTree parentId=''>
    <@_categoryList advanced=true parentId=parentId>
        <#list page.list as a>
            <li>
                <a href="javascript:;" class="exclude-translate" onclick="$.bringBack({itemType:'category',itemId:'${a.id}',title:'${(a.name?js_string)!}',url:'${a.url!}'});return false;">${a.name!}</a>
            <#if a.childIds?has_content>
                <ul>
                    <@lookupTree a.id/>
                </ul>
            </#if>
            </li>
        </#list>
    </@_categoryList>
</#macro>
<#macro pageTree filepath=''>
    <@_templateList path=filepath orderField='createDate'>
        <#list list as a>
            <#local path=filepath+'/'+a.fileName>
            <li>
            <@_metadata path=path>
                <#if a.directory>
                    <a href="javascript:;" onclick="return false;">
                        ${(object.alias)?has_content?then(object.alias+' ('+a.fileName+')',a.fileName)}
                    </a>
                    <ul>
                        <@pageTree path/>
                    </ul>
                <#else>
                    <#if site.useStatic&&(object.publishPath)?has_content>
                        <a href="javascript:;" onclick="$.bringBack({itemType:'page',title:'${(object.alias)!}',url:'${site.sitePath+(object.publishPath?starts_with('/'))?then(object.publishPath?keep_after('/'),object.publishPath)}'});return false;">
                            [<@t.page 'static_page'/>] ${(object.alias)?has_content?then(object.alias+' ('+a.fileName+')',a.fileName)}
                        </a>
                    </#if>
                    <#if (object.useDynamic)?has_content&&object.useDynamic>
                        <a href="javascript:;" onclick="$.bringBack({itemType:'page',title:'${(object.alias)!}',url:'${site.dynamicPath+(path?starts_with('/'))?then(path?keep_after('/'),path)}<#if (object.acceptParameters)?has_content>?<#list object.acceptParameters?split(',') as a>${a}=<#if 'content'=(object.parameterTypeMap[a].type)!><@_contentList pageSize=1><#list page.list as a>${a.id}</#list></@_contentList><#elseif 'category'=(object.parameterTypeMap[a].type)!><@_categoryList pageSize=1><#list page.list as a>${a.id}</#list></@_categoryList></#if><#sep>&</#list></#if>'});return false;">
                            [<@t.page 'dynamic_page'/>] ${(object.alias)?has_content?then(object.alias+' ('+a.fileName+')',a.fileName)}
                        </a>
                    </#if>
                </#if>
            </@_metadata>
            </li>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@_templateList>
</#macro>
<#assign itemTypes=acceptItemTypes?has_content?then(acceptItemTypes?split(','),['page','content','category'])/>
<div class="tabs">
    <div class="tabsHeader">
        <div class="tabsHeaderContent">
            <ul>
            <#if itemTypes?seq_contains('content')>
                <li><a href="javascript:;" onclick="return false;"><@t.page 'content'/></a></li>
            </#if>
            <#if itemTypes?seq_contains('category')>
                <li><a href="javascript:;" onclick="return false;"><@t.page 'category'/></a></li>
            </#if>
            <#if itemTypes?seq_contains('page')>
                <li><a href="javascript:;" onclick="return false;"><@t.page 'page'/></a></li>
            </#if>
            </ul>
        </div>
    </div>
    <div class="tabsContent">
    <#if itemTypes?seq_contains('content')>
        <div class="pageContent" layoutH>
            <div class="unitBox leftPageContent" layoutH>
                <ul class="tree treeFolder">
                    <li>
                        <a href="cmsPlace/lookup_content_list.html" target="ajax" rel="lookup_content_list"><@t.page 'category'/></a>
                        <ul>
                            <@categoryTree/>
                        </ul>
                    </li>
                 </ul>
            </div>
            <div id="lookup_content_list" class="unitBox rightPageContent">
                <#include "lookup_content_list.html"/>
            </div>
        </div>
    </#if>
    <#if itemTypes?seq_contains('category')>
        <div class="pageFormContent" layoutH>
            <ul class="tree treeFolder expand">
                <@lookupTree/>
            </ul>
        </div>
    </#if>
    <#if itemTypes?seq_contains('page')>
        <div class="pageFormContent" layoutH>
            <ul class="tree treeFolder expand">
                <@pageTree/>
            </ul>
        </div>
    </#if>
    </div>
</div>